#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2021/12/24 13:31
    Desc  :
--------------------------------------
"""
from common.tools.CommonRequestsClient import PostRequestClient


class WxChatRobotClient():
    """微信机器人"""

    def __init__(self, webhook: str, message: dict):
        self.message = message
        self.webhook = webhook

    def send(self):
        postRequestClient = PostRequestClient()
        postRequestClient.url = self.webhook
        postRequestClient.body = self.message
        postRequestClient.result()


if __name__ == '__main__':
    w = WxChatRobotClient(
        webhook = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=2c09fff9-0706-45a3-9348-54b425661b8f',
        message = {
            "msgtype": "text",
            "text": {
                "content": "广州今日天气：29度，大部分多云，降雨概率：60%",
                "mentioned_mobile_list":["15927549205","@all"]
            }
        })

    w.send()
